package roborally.model.evaluables.conditions;

import roborally.model.evaluables.Evaluable;
import roborally.model.evaluables.RobotCondition;
import roborally.model.*;

public class WallOnRight extends RobotCondition implements Evaluable{
	public WallOnRight(Robot robot) throws IllegalArgumentException {
		super(robot);
	}
	
	/**
	 * @return Returns true if the field on the right of the robot has a wall on it. If not, false is returned.
	 */
	@Override
	public boolean evaluate(){
		Field field = getRobot().getField().getBoard().getNextFieldIntoDirection( getRobot().getField(), getRobot().getOrientation().turn(Orientation.clockwise) );
		if(field != null && field.hasWall()) return true;
		return false;
	}

}